/*
 * Alexey Danchuk
 * This software is an implementation of the task from OOP module.
 */
package knowledgetestsystem;

/**
 * This class describes logical question type.
 * 
 * @version 2.03 10 February 2013
 * @author Alexey Danchuk
 */
class LogicalQuestion extends Question {
	/**
	 * This variable holds the correct answer to the question.
	 */
	private String[] correctAnswers;
	private static final int MAX_SCORE = 1;
	private static final int ZERO_SCORE = 0;

	protected LogicalQuestion(final String inQuestion,
							  final String[] inAnswers,
							  final String[] correctAnswers) {
		super(inQuestion, inAnswers);
		saveAnswer(correctAnswers);
	}

	@Override
	protected int chekAnswer(final String[] userAnswers) {
		if (userAnswers.length > 1) {
			return ZERO_SCORE;
		}
		if (userAnswers[0].equals("true")) {
			return MAX_SCORE;
		} else {
			return ZERO_SCORE;
		}
	}

	@Override
	protected void saveAnswer(final String[] answers) {
		correctAnswers = answers;
	}
}
